#include<stdio.h>

 
int fan(int n)

 
{

 
    if((n%4==0&&n%100!=0)||n%400==0){

 
        return 1;

 
    }

 
    else 

 
    return 0;

 
}

 
int main()

 
{

 
    int year,month,day,result=0;

 
    scanf("%d/%d/%d/",&year,&month,&day);

 
    

 
    switch(month){

 
    case 1:  result=day;break;

 
    case 2:  result=31+day;break;

 
    case 3:  result=59+day;break;

 
    case 4:  result=90+day;break;

 
    case 5:  result=120+day;break;

 
    case 6:  result=151+day;break;

 
    case 7:  result=181+day;break;

 
    case 8:  result=212+day;break;

 
    case 9:  result=243+day;break;

 
    case 10:  result=273+day;break; 

 
    case 11:  result=304+day;break;

 
    case 12:  result=334+day;break;

 
    }

 


 
    

 
    if(fan(year)&&month>=3)

 
    {

 
        result=result+1;

 
    }

 
    printf("%d",result);

 


 
    return 0;

 
}

 

